
#include    <stdio.h>

#include    "acel/inet_addr.hpp"

#include    "test/logger.hpp"

using namespace std;
using namespace test;
using namespace acel;

static  int
test_case_1( void )
{
    Logger& logger = test::Logger::getInstance();

    INET_Addr   addr_default;
    logger.info("default    : '%s:%d'", addr_default.getHostName(), addr_default.getPortNumber());
        
    INET_Addr   addr_rend("192.168.0.1:4344");
    logger.info("rendezvous : '%s'", addr_rend.getHostAddr());
    logger.info("rendezvous : '%s:%d'", addr_rend.getHostName(), addr_rend.getPortNumber());

    INET_Addr   addr_copy(addr_rend);
    logger.info("copy-ctor  : '%s'", addr_copy.getHostAddr());
    logger.info("copy-ctor  : '%s:%d'", addr_copy.getHostName(), addr_copy.getPortNumber());
            
    if ( addr_rend == addr_copy ) {
        logger.info("rendezvous-addr == copy-ctor-addr");
    }
    else {
        logger.info("rendezvous-addr != copy-ctor-addr");
    }
    
    char    szBuf[128];
    addr_rend.toString(szBuf, sizeof(szBuf));
    logger.info("rendezvous-addr.toString() get '%s'", szBuf);
    
    INET_Addr   addr_ipany(4344);
    logger.info("ip-any     : '%s'", addr_ipany.getHostAddr());
    logger.info("ip-any     : '%s:%d'", addr_ipany.getHostName(), addr_ipany.getPortNumber());
    
    return  0;  
}


int main(int argc, char* argv[])
{
    Logger& logger = test::Logger::getInstance();
    logger.info("==== test begin ====");

    test_case_1();
        
    logger.info("==== test   end ====");
    return  0;
}

